﻿<Window x:Uid="Window_1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        x:Class="WgpgGUI.DialogKeyInformation"
        xmlns:my="clr-namespace:WgpgGUI"
        Icon="/WgpgCore;component/Images/keyproperty1.png"
        SizeToContent="WidthAndHeight"
        ResizeMode="NoResize"
        WindowStartupLocation="CenterScreen"
        SnapsToDevicePixels="True">

    <Window.Title>
        <Binding x:Uid="Binding_1" Path="KeyNode.UserInfos[0].Name" StringFormat="{}{0} - Key Property"/>
    </Window.Title>

    <Window.CommandBindings>
        <CommandBinding x:Uid="CommandBinding_1" Command="{x:Static my:DialogKeyInformation.PasteImageCommand}" CanExecute="PasteImage_CanExecute" Executed="PasteImage_Executed"/>
        <CommandBinding x:Uid="CommandBinding_2" Command="{x:Static my:DialogKeyInformation.AddUserIdentityCommand}" CanExecute="AddUserIdentifiant_CanExecute" Executed="AddUserIdentifiant_Executed"/>
        <CommandBinding x:Uid="CommandBinding_3" Command="{x:Static my:DialogKeyInformation.RemoveUserIdentityCommand}" CanExecute="RemoveUserIdentifiant_CanExecute" Executed="RemoveUserIdentifiant_Executed"/>
        <CommandBinding x:Uid="CommandBinding_4" Command="{x:Static my:DialogKeyInformation.ChangePrimaryIdentityCommand}" CanExecute="ChangePrimaryIdentifiant_CanExecute" Executed="ChangePrimaryIdentifiant_Executed"/>
    </Window.CommandBindings>
    
    <Grid x:Uid="Grid_1">
        <Grid.RowDefinitions>
            <RowDefinition x:Uid="RowDefinition_1" Height="Auto"/>
            <RowDefinition x:Uid="RowDefinition_2" Height="*"/>
            <RowDefinition x:Uid="RowDefinition_3" Height="Auto"/>
        </Grid.RowDefinitions>
        
        <Grid x:Uid="Grid_2" Grid.Row="0">
            <Grid.Background>
                <LinearGradientBrush x:Uid="LinearGradientBrush_1" EndPoint="0,1" StartPoint="0,0">
                    <GradientStop x:Uid="GradientStop_1" Color="#FFE7A4" Offset="0"/>
                    <GradientStop x:Uid="GradientStop_2" Color="#FFE8A6" Offset="0.5"/>
                    <GradientStop x:Uid="GradientStop_3" Color="#FDD04F" Offset="1"/>
                </LinearGradientBrush>
            </Grid.Background>
            <Grid.Effect>
                <DropShadowEffect x:Uid="DropShadowEffect_1" Color="#020202" Direction="270" ShadowDepth="5" Opacity="0.3" BlurRadius="10"/>
            </Grid.Effect>

            <DockPanel x:Uid="DockPanel_1">
                <Button x:Uid="btnRemoveIdentity" Name="btnRemoveIdentity" DockPanel.Dock="Right" HorizontalAlignment="Right" Width="21" Padding="0" Margin="0 0 10 0" MinWidth="0" Height="21" Command="{x:Static my:DialogKeyInformation.RemoveUserIdentityCommand}" ToolTip="Remove this identity">
                    <my:AutoGreyableImage x:Uid="my:AutoGreyableImage_1" Source="/WgpgCore;component/Images/trash.gif" Width="16"/>
                </Button>
                <Button x:Uid="btnAddIdentity" Name="btnAddIdentity" DockPanel.Dock="Right" HorizontalAlignment="Right" Width="21" Padding="0" Margin="0 0 5 0" MinWidth="0" Height="21" Command="{x:Static my:DialogKeyInformation.AddUserIdentityCommand}" ToolTip="Add a new identity">
                    <my:AutoGreyableImage x:Uid="my:AutoGreyableImage_2" Source="/WgpgCore;component/Images/add_user.png" Width="16"/>
                </Button>
                <Button x:Uid="btnPrimary" Name="btnPrimary" DockPanel.Dock="Right" HorizontalAlignment="Right" Width="21" Padding="0" Margin="0 0 5 0" MinWidth="0" Height="21" Command="{x:Static my:DialogKeyInformation.ChangePrimaryIdentityCommand}" ToolTip="Set as primary identity">
                    <my:AutoGreyableImage x:Uid="my:AutoGreyableImage_3" Source="/WgpgCore;component/Images/primary.png" Width="16"/>
                </Button>
                <ComboBox x:Uid="combo_names" Name="combo_names" BorderBrush="#FFC00F" ItemsSource="{Binding Path=KeyNode.UserInfos}" Margin="10 7 5 7" SelectedIndex="0" DisplayMemberPath="FullInfo" IsReadOnly="True" IsEditable="True"/>
            </DockPanel>
        </Grid>

        <Grid x:Uid="Grid_3" VerticalAlignment="Stretch" Margin="10" HorizontalAlignment="Stretch" Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition x:Uid="ColumnDefinition_1" Width="150"/>
                <ColumnDefinition x:Uid="ColumnDefinition_2" Width="Auto"/>
                <ColumnDefinition x:Uid="ColumnDefinition_3" Width="*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition x:Uid="RowDefinition_4" Height="Auto"/>
                <RowDefinition x:Uid="RowDefinition_5" Height="Auto"/>
                <RowDefinition x:Uid="RowDefinition_6" Height="Auto"/>
                <RowDefinition x:Uid="RowDefinition_7" Height="Auto"/>
                <RowDefinition x:Uid="RowDefinition_8" Height="Auto"/>
                <RowDefinition x:Uid="RowDefinition_9" Height="Auto"/>
                <RowDefinition x:Uid="RowDefinition_10" Height="Auto"/>
                <RowDefinition x:Uid="RowDefinition_11" Height="Auto"/>
                <RowDefinition x:Uid="RowDefinition_12" Height="Auto"/>
            </Grid.RowDefinitions>

            <GroupBox x:Uid="GroupBox_1" Header="Photo" Margin="0 0 5 0" Grid.Column="0" Grid.Row="0" Grid.RowSpan="8" AllowDrop="True" Drop="DropImage" DragEnter="DragEnterImage" DragOver="DragEnterImage">
                <Grid x:Uid="Grid_4" Background="White">
                    <Grid.ContextMenu>
                        <ContextMenu x:Uid="image_menu" Name="image_menu">
                            <MenuItem x:Uid="MenuItem_1" Header="Paste Photo" Command="{x:Static my:DialogKeyInformation.PasteImageCommand}"/>
                        </ContextMenu>
                    </Grid.ContextMenu>
                    <Image x:Uid="no_image_photo" Name="no_image_photo" Source="/WgpgCore;component/Images/No_Image_Available.gif" Stretch="Uniform" HorizontalAlignment="Center" VerticalAlignment="Top"/>
                    <Image x:Uid="image_photo" Name="image_photo" Source="{Binding Path=DisplayedPhoto}" Stretch="Uniform" HorizontalAlignment="Center" VerticalAlignment="Top" Visibility="Collapsed"/>
                    <DockPanel x:Uid="NavigationButtons" HorizontalAlignment="Stretch" VerticalAlignment="Center" Opacity="0" Name="NavigationButtons">
                        <Button x:Uid="previous_photo_button" Name="previous_photo_button" Style="{StaticResource ResourceKey=LeftButton}" Width="18" HorizontalAlignment="Left" Content="See previous photo" ToolTip="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=Content}" Click="PreviousPhoto"/>
                        <Button x:Uid="next_photo_button" Name="next_photo_button" Style="{StaticResource ResourceKey=RightButton}" Width="18" HorizontalAlignment="Right" Content="See next photo" ToolTip="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=Content}" Click="NextPhoto"/>
                    </DockPanel>
                    <StackPanel x:Uid="PhotoButtons" Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Bottom" Opacity="0" Name="PhotoButtons">
                        <Button x:Uid="add_button" Name="add_button" Width="24" Style="{StaticResource ResourceKey=AddButton}" Content="Add a photo" ToolTip="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=Content}" Click="AddPhoto"/>
                        <Button x:Uid="remove_button" Name="remove_button" Width="24" Style="{StaticResource ResourceKey=RemoveButton}" Content="Remove this photo" ToolTip="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=Content}" IsEnabled="False" Click="RemovePhoto"/>
                    </StackPanel>
                </Grid>

                <GroupBox.Triggers>
                    <EventTrigger x:Uid="EventTrigger_1" RoutedEvent="GotFocus">
                        <EventTrigger.Actions>
                            <BeginStoryboard x:Uid="BeginStoryboard_1">
                                <Storyboard x:Uid="Storyboard_1">
                                    <DoubleAnimation x:Uid="DoubleAnimation_1" Storyboard.TargetName="PhotoButtons" Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.2"/>
                                    <DoubleAnimation x:Uid="DoubleAnimation_2" Storyboard.TargetName="NavigationButtons" Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.2"/>
                                </Storyboard>
                            </BeginStoryboard>
                        </EventTrigger.Actions>
                    </EventTrigger>
                    <EventTrigger x:Uid="EventTrigger_2" RoutedEvent="LostFocus">
                        <EventTrigger.Actions>
                            <BeginStoryboard x:Uid="BeginStoryboard_2">
                                <Storyboard x:Uid="Storyboard_2">
                                    <DoubleAnimation x:Uid="DoubleAnimation_3" Storyboard.TargetName="PhotoButtons" Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:0.2"/>
                                    <DoubleAnimation x:Uid="DoubleAnimation_4" Storyboard.TargetName="NavigationButtons" Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:0.2"/>
                                </Storyboard>
                            </BeginStoryboard>
                        </EventTrigger.Actions>
                    </EventTrigger>
                    <EventTrigger x:Uid="EventTrigger_3" RoutedEvent="MouseEnter">
                        <EventTrigger.Actions>
                            <BeginStoryboard x:Uid="BeginStoryboard_3">
                                <Storyboard x:Uid="Storyboard_3">
                                    <DoubleAnimation x:Uid="DoubleAnimation_5" Storyboard.TargetName="PhotoButtons" Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.2"/>
                                    <DoubleAnimation x:Uid="DoubleAnimation_6" Storyboard.TargetName="NavigationButtons" Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.2"/>
                                </Storyboard>
                            </BeginStoryboard>
                        </EventTrigger.Actions>
                    </EventTrigger>
                    <EventTrigger x:Uid="EventTrigger_4" RoutedEvent="MouseLeave">
                        <EventTrigger.Actions>
                            <BeginStoryboard x:Uid="BeginStoryboard_4">
                                <Storyboard x:Uid="Storyboard_4">
                                    <DoubleAnimation x:Uid="DoubleAnimation_7" Storyboard.TargetName="PhotoButtons" Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:0.2"/>
                                    <DoubleAnimation x:Uid="DoubleAnimation_8" Storyboard.TargetName="NavigationButtons" Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:0.2"/>
                                </Storyboard>
                            </BeginStoryboard>
                        </EventTrigger.Actions>
                    </EventTrigger>
                </GroupBox.Triggers>
            </GroupBox>

            <Label x:Uid="Label_1" Grid.Column="1" Grid.Row="0" Content="ID" HorizontalAlignment="Right" FontWeight="Bold"/>
            <Label x:Uid="Label_2" Grid.Column="1" Grid.Row="1" Content="Algorithm" HorizontalAlignment="Right" FontWeight="Bold"/>
            <Label x:Uid="Label_3" Grid.Column="1" Grid.Row="2" Content="Size" HorizontalAlignment="Right" FontWeight="Bold"/>
            <Label x:Uid="Label_4" Grid.Column="1" Grid.Row="3" Content="Trust" HorizontalAlignment="Right" FontWeight="Bold"/>
            <Label x:Uid="Label_5" Grid.Column="1" Grid.Row="4" Content="Owner Trust" HorizontalAlignment="Right" FontWeight="Bold"/>
            <Label x:Uid="Label_6" Grid.Column="1" Grid.Row="5" Content="Disabled" HorizontalAlignment="Right" FontWeight="Bold"/>
            <Label x:Uid="Label_7" Grid.Column="1" Grid.Row="6" Content="Creation Date" HorizontalAlignment="Right" FontWeight="Bold"/>
            <Label x:Uid="Label_8" Grid.Column="1" Grid.Row="7" Content="Expiration Date" HorizontalAlignment="Right" FontWeight="Bold"/>

            <TextBox x:Uid="TextBox_1" Grid.Column="2" Grid.Row="0" BorderThickness="0" VerticalAlignment="Center" IsReadOnly="True" IsTabStop="False" Text="{Binding Path=KeyNode.Id, Mode=OneWay}"/>
            <TextBox x:Uid="TextBox_2" Grid.Column="2" Grid.Row="1" BorderThickness="0" VerticalAlignment="Center" IsReadOnly="True" IsTabStop="False" Text="{Binding Path=KeyNode.Algorithm, Mode=OneWay}"/>
            <TextBox x:Uid="TextBox_3" Grid.Column="2" Grid.Row="2" BorderThickness="0" VerticalAlignment="Center" IsReadOnly="True" IsTabStop="False" Text="{Binding Path=KeyNode.Size, Mode=OneWay}"/>
            <TextBox x:Uid="TextBox_4" Grid.Column="2" Grid.Row="3" BorderThickness="0" VerticalAlignment="Center" IsReadOnly="True" IsTabStop="False" Text="{Binding Path=KeyNode.Trust, Mode=OneWay, Converter={StaticResource TrustToStringConverter}}"/>
            <ComboBox x:Uid="combo_ownertrust" Grid.Column="2" Grid.Row="4" VerticalAlignment="Bottom" Name="combo_ownertrust" SelectionChanged="ChangeTrust" Margin="0,0,0,2">
                <ComboBoxItem x:Uid="ComboBoxItem_1" Content="Ultimate"/>
                <ComboBoxItem x:Uid="ComboBoxItem_2" Content="Full"/>
                <ComboBoxItem x:Uid="ComboBoxItem_3" Content="Marginal"/>
                <ComboBoxItem x:Uid="ComboBoxItem_4" Content="None"/>
            </ComboBox>
            <ComboBox x:Uid="combo_disabled" Grid.Column="2" Grid.Row="5" VerticalAlignment="Center" Name="combo_disabled" SelectionChanged="ChangeDisable">
                <ComboBoxItem x:Uid="ComboBoxItem_5" Content="Yes" IsSelected="{Binding Path=KeyNode.IsDisabled, Mode=OneWay}"/>
                <ComboBoxItem x:Uid="ComboBoxItem_6" Content="No" IsSelected="{Binding Path=KeyNode.IsDisabled, Mode=OneWay, Converter={StaticResource OppositeBoolConverter}}"/>
            </ComboBox>
            <TextBox x:Uid="TextBox_5" Grid.Column="2" Grid.Row="6" BorderThickness="0" VerticalAlignment="Center" IsReadOnly="True" IsTabStop="False" Text="{Binding Path=KeyNode.CreationDate.Date, StringFormat={}{0:D}, Mode=OneWay}"/>
            <TextBox x:Uid="TextBox_6" Grid.Column="2" Grid.Row="7" BorderThickness="0" VerticalAlignment="Center" IsReadOnly="True" IsTabStop="False" Text="{Binding Path=KeyNode.ExpirationDate, Mode=OneWay, Converter={StaticResource GpgDateTimeToStringConverter}}"/>

            <GroupBox x:Uid="GroupBox_2" Header="FingerPrint" Margin="0 5 0 0" Grid.Column="0" Grid.Row="9" Grid.ColumnSpan="3" Padding="10">
                <TextBox x:Uid="TextBox_7" BorderThickness="0" VerticalAlignment="Center" IsReadOnly="True" IsTabStop="False" Text="{Binding Path=KeyNode.FingerPrintBeautified, Mode=OneWay}"/>
            </GroupBox>
        </Grid>

        <StackPanel x:Uid="StackPanel_1" Background="#F0F0F0" Grid.Row="2">
            <Border x:Uid="Border_1" BorderBrush="#DFDFE0" Height="1" BorderThickness="1"/>
            <StackPanel x:Uid="StackPanel_2" HorizontalAlignment="Right" Orientation="Horizontal">
                <Button x:Uid="password_button" Content="Change _Passphrase" Width="Auto" Click="ChangePassword" Name="password_button"/>
                <Button x:Uid="Button_1" Content="_Close" Width="Auto" IsDefault="True" IsCancel="True"/>
            </StackPanel>
        </StackPanel>
    </Grid>
</Window>
